home *** CD-ROM | disk | FTP | other *** search
/ Enter 2005 December / enter-cd-12-2005.iso / Internet / SpamAware 4.0 / SpamAware-Setup.exe / {app} / rules / 20_body_tests.cf < prev    next >
Encoding:
Text File  |  2005-06-20  |  8.2 KB  |  187 lines

  1. # SpamAssassin rules file: body tests
  2. #
  3. # Please don't modify this file as your changes will be overwritten with
  4. # the next update. Use @@LOCAL_RULES_DIR@@/local.cf instead.
  5. # See 'perldoc Mail::SpamAssassin::Conf' for details.
  6. #
  7. # Note: body tests are run with long lines, so be sure to limit the
  8. # size of searches; use /.{0,30}/ instead of /.*/ to avoid huge
  9. # search times.
  10. #
  11. # Note: If you are adding a rule which looks for a phrase in the body
  12. # (as most of them do), please add it to rules/20_phrases.cf instead.
  13. #
  14. # <@LICENSE>
  15. # Copyright 2004 Apache Software Foundation
  16. # Licensed under the Apache License, Version 2.0 (the "License");
  17. # you may not use this file except in compliance with the License.
  18. # You may obtain a copy of the License at
  19. #     http://www.apache.org/licenses/LICENSE-2.0
  20. # Unless required by applicable law or agreed to in writing, software
  21. # distributed under the License is distributed on an "AS IS" BASIS,
  22. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. # See the License for the specific language governing permissions and
  24. # limitations under the License.
  25. # </@LICENSE>
  26. #
  27. ###########################################################################
  28.  
  29. require_version @@VERSION@@
  30.  
  31. ###########################################################################
  32. # GTUBE test - the generic test for UBE.
  33. body GTUBE        /XJS\*C4JDBQADN1\.NSBN3\*2IDNEN\*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL\*C\.34X/
  34. describe GTUBE        Generic Test for Unsolicited Bulk Email
  35. tflags GTUBE        userconf noautolearn
  36.  
  37. ###########################################################################
  38. # Message digest tests
  39.  
  40. full RAZOR2_CHECK    eval:check_razor2()
  41. describe RAZOR2_CHECK    Listed in Razor2 (http://razor.sf.net/)
  42. tflags RAZOR2_CHECK    net
  43.  
  44. # cf (confidence level) is how likely the message is spam.  RAZOR2_CHECK
  45. # returns true if cf>=min_cf (as defined by user/config).  These return
  46. # true depending on what cf value the message has.  The algorithm goes:
  47. # check the message via razor, then go through each mime part and check
  48. # how razor scored it.  If the part is contested (ie: it's been reported
  49. # as both ham and spam) it's ignored.  SA takes the highest non-contested
  50. # part cf score and returns it for the range rules.  ie: This is essentially
  51. # Razor 2's logic_method 4.
  52. #
  53. # Note: Disabling RAZOR2_CHECK (score RAZOR2_CHECK 0) will also disable
  54. # these checks.
  55. #
  56. # Note: The scores are set to 0 on these tests right now until they get
  57. # better integrated with SA overall.
  58. #
  59. body    RAZOR2_CF_RANGE_51_100    eval:check_razor2_range('51','100')
  60. tflags  RAZOR2_CF_RANGE_51_100    net
  61. describe RAZOR2_CF_RANGE_51_100    Razor2 gives confidence level above 50%
  62.  
  63. full DCC_CHECK        eval:check_dcc()
  64. describe DCC_CHECK    Listed in DCC (http://rhyolite.com/anti-spam/dcc/)
  65. tflags DCC_CHECK    net
  66.  
  67. full PYZOR_CHECK    eval:check_pyzor()
  68. describe PYZOR_CHECK    Listed in Pyzor (http://pyzor.sf.net/)
  69. tflags PYZOR_CHECK    net
  70.  
  71. # bug 2220. nice results
  72. meta DIGEST_MULTIPLE       RAZOR2_CHECK + DCC_CHECK + PYZOR_CHECK > 1
  73. describe DIGEST_MULTIPLE   Message hits more than one network digest check
  74. tflags DIGEST_MULTIPLE     net
  75.  
  76. # this seems to be the new fashion (as of Jul 5 2002).  base64-encoded parts need to
  77. # be stripped before this match
  78. body TRACKER_ID        /^[a-z0-9]{6,24}[-_a-z0-9]{12,36}[a-z0-9]{6,24}\s*\z/is
  79. describe TRACKER_ID    Incorporates a tracking ID number
  80.  
  81. body WEIRD_QUOTING    /[\042\223\224\262\263\271]{2}\S{0,16}[\042\223\224\262\263\271]{2}/
  82. describe WEIRD_QUOTING    Weird repeated double-quotation marks
  83.  
  84. ###########################################################################
  85. # these tests doesn't actually use rawbody since rawbody isn't raw enough;
  86. # they must be written very carefully to avoid modifying the original content
  87.  
  88. # MIME Content-Transfer-Encoding control rules
  89. rawbody __MIME_BASE64        eval:check_for_mime('mime_base64_count')
  90. describe __MIME_BASE64        Includes a base64 attachment
  91.  
  92. rawbody __MIME_QP        eval:check_for_mime('mime_qp_count')
  93. describe __MIME_QP        Includes a quoted-printable attachment
  94.  
  95. rawbody MIME_BASE64_BLANKS    eval:check_for_mime('mime_base64_blanks')
  96. describe MIME_BASE64_BLANKS    Extra blank lines in base64 encoding
  97.  
  98. rawbody MIME_BASE64_NO_NAME    eval:check_for_mime('mime_base64_no_name')
  99. describe MIME_BASE64_NO_NAME    base64 attachment does not have a file name
  100.  
  101. rawbody MIME_BASE64_TEXT    eval:check_for_mime('mime_base64_encoded_text')
  102. describe MIME_BASE64_TEXT    Message text disguised using base64 encoding
  103.  
  104. rawbody  MIME_MISSING_BOUNDARY    eval:check_for_mime('mime_missing_boundary')
  105. describe MIME_MISSING_BOUNDARY    MIME section missing boundary
  106.  
  107. body MIME_HTML_MOSTLY        eval:check_mime_multipart_ratio('0.00','0.01')
  108. describe MIME_HTML_MOSTLY    Multipart message mostly text/html MIME
  109.  
  110. # Steve Linford via Charlie Watts: good test!
  111. body MIME_HTML_ONLY        eval:check_for_mime_html_only()
  112. describe MIME_HTML_ONLY        Message only has text/html MIME parts
  113.  
  114. # multipart/alternative has very good accuracy, other multipart types are
  115. # similar to MIME_HTML_ONLY so they don't need a separate rule
  116. header __CTYPE_MULTIPART_ALT    Content-Type =~ /multipart\/alternative/i
  117. meta MIME_HTML_ONLY_MULTI    (__CTYPE_MULTIPART_ALT && MIME_HTML_ONLY)
  118. describe MIME_HTML_ONLY_MULTI    Multipart message only has text/html MIME parts
  119.  
  120. rawbody  MIME_QP_LONG_LINE    eval:check_for_mime('mime_qp_long_line')
  121. describe MIME_QP_LONG_LINE    Quoted-printable line longer than 76 chars
  122.  
  123. # actually indicates viruses, typically; just used here to clean corpora.
  124. rawbody  MIME_SUSPECT_NAME    eval:check_for_mime('mime_suspect_name')
  125. describe MIME_SUSPECT_NAME    MIME filename does not match content
  126. # todo: better tflags category for these tests
  127. tflags MIME_SUSPECT_NAME userconf
  128.  
  129. # note: __HIGHBITS is used by HTML_CHARSET_FARAWAY
  130. rawbody __MIME_CHARSET_FARAWAY    eval:check_for_mime('mime_faraway_charset')
  131. body __HIGHBITS            /(?:[\x80-\xff].?){4,}/
  132. meta MIME_CHARSET_FARAWAY    (__MIME_CHARSET_FARAWAY && __HIGHBITS)
  133. describe MIME_CHARSET_FARAWAY    MIME character set indicates foreign language
  134. tflags MIME_CHARSET_FARAWAY    userconf
  135.  
  136. # This rule uses a simple algorithm to determine if the text and html
  137. # parts of an multipart/alternative message are different.
  138. body MPART_ALT_DIFF    eval:multipart_alternative_difference('99', '100')
  139. describe MPART_ALT_DIFF    HTML and text parts are different
  140.  
  141. ###########################################################################
  142.  
  143. body CHARSET_FARAWAY        eval:check_for_faraway_charset()
  144. describe CHARSET_FARAWAY    Character set indicates a foreign language
  145. tflags CHARSET_FARAWAY        userconf
  146.  
  147. body UNWANTED_LANGUAGE_BODY    eval:check_language()
  148. describe UNWANTED_LANGUAGE_BODY    Message written in an undesired language
  149. tflags UNWANTED_LANGUAGE_BODY    userconf
  150.  
  151. body BODY_8BITS            eval:check_for_body_8bits()
  152. describe BODY_8BITS        Body includes 8 consecutive 8-bit characters
  153. tflags BODY_8BITS        userconf
  154.  
  155. # duncf
  156. body EMAIL_ROT13     /\b[a-z(\]-]+\^[a-z-]+\([a-z]{2,3}\b/
  157. describe EMAIL_ROT13 Body contains a ROT13-encoded email address
  158. test EMAIL_ROT13 ok  qhabs^ebtref(pbz
  159. test EMAIL_ROT13 ok  zxrggyre^riv-vap(pbz
  160. test EMAIL_ROT13 fail    duncf-nospam@rogers.com
  161.  
  162. body BLANK_LINES_70_80    eval:check_blank_line_ratio('70','80','4')
  163. body BLANK_LINES_80_90    eval:check_blank_line_ratio('80','90','4')
  164. body BLANK_LINES_90_100    eval:check_blank_line_ratio('90','100','4')
  165. describe BLANK_LINES_70_80  Message body has 70-80% blank lines
  166. describe BLANK_LINES_80_90  Message body has 80-90% blank lines
  167. describe BLANK_LINES_90_100 Message body has 90-100% blank lines
  168.  
  169. body UNIQUE_WORDS    eval:check_unique_words('0.946', '3.1')
  170. describe UNIQUE_WORDS    Message body has many words used only once
  171.  
  172. body DOMAIN_RATIO    eval:check_domain_ratio('0.022')
  173. describe DOMAIN_RATIO    Message body mentions many internet domains
  174.  
  175. # If these are too expensive as a whole, then delete __LONGWORDS_B and
  176. # __LONGWORDS_C and replace with (__LONGWORDS_D || __LONGWORDS_A) which
  177. # is very close in quality.
  178. body __LONGWORDS_A    /\b(?:[a-z]{8,}\s+){6}/
  179. body __LONGWORDS_B    /\b(?:[a-z]{7,}\s+){8}/
  180. body __LONGWORDS_C    /\b(?:[a-z]{6,}\s+){9}/
  181. body __LONGWORDS_D    /\b(?:[a-z]{5,}\s+){10}/
  182. meta LONGWORDS        (__LONGWORDS_A || __LONGWORDS_B || __LONGWORDS_C || __LONGWORDS_D)
  183. describe LONGWORDS    Long string of long words
  184.